package basicas;

/**
 * @author Junior 
 */

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

@Entity
@DiscriminatorValue("ALUNO")
public class Aluno extends Pessoa {

	private int cpf;
	private int matricula;
	private Date dataNascimento;
	@ManyToMany
	@JoinTable(name = "aluno_expertise", joinColumns = { @JoinColumn(name = "codAluno") }, inverseJoinColumns = { @JoinColumn(name = "codExpertise") })
	@Cascade(CascadeType.ALL)
	private List<Expertises> expertises;
	@ManyToMany
	@JoinTable(name = "aluno_badge", joinColumns = { @JoinColumn(name = "codAluno") }, inverseJoinColumns = { @JoinColumn(name = "codBadge") })
	@Cascade(CascadeType.ALL)
	private List<Badge> badges;
	@ManyToOne
	@JoinColumn(name = "id", insertable = false, updatable = false)
	@Fetch(FetchMode.JOIN)
	@Cascade(CascadeType.SAVE_UPDATE)
	private Equipe equipe;
	@ManyToOne
	@JoinColumn(name = "id", insertable = false, updatable = false)
	@Fetch(FetchMode.JOIN)
	@Cascade(CascadeType.SAVE_UPDATE)
	private Sprint sprint;

	public Aluno() {
	}

	public void setSprint(Sprint sprint) {
		this.sprint = sprint;
	}

	public int getCpf() {
		return cpf;
	}

	public void setCpf(int cpf) {
		this.cpf = cpf;
	}

	public int getMatricula() {
		return matricula;
	}

	public void setMatricula(int matricula) {
		this.matricula = matricula;
	}

	public Date getDataNascimento() {
		return dataNascimento;
	}

	public void setDataNascimento(Date dataNascimento) {
		this.dataNascimento = dataNascimento;
	}

	public List<Expertises> getExpertises() {
		return expertises;
	}

	public void setExpertises(List<Expertises> expertises) {
		this.expertises = expertises;
	}

	public List<Badge> getBadges() {
		return badges;
	}

	public void setBadges(List<Badge> badges) {
		this.badges = badges;
	}

	public Equipe getEquipe() {
		return equipe;
	}

	public void setEquipe(Equipe equipe) {
		this.equipe = equipe;
	}

	public Sprint getSprint() {
		return sprint;
	}

	public void setSprints(Sprint sprint) {
		this.sprint = sprint;
	}

}
